X Error of failed request: BadMatch [migrated]
Posted
by
Andrew Grabko
on Game Development
See other posts from Game Development
or by Andrew Grabko
Published on 2011-10-25T21:22:23Z
Indexed on
2011/11/19
2:09 UTC
Read the original article
Hit count: 289
I'm trying to execute some "hello world" opengl code:
#include <GL/freeglut.h>
void displayCall() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
... Some more code here
glutSwapBuffers();
}
int main(int argc, char *argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutInitWindowPosition(300, 200);
glutInitContextVersion(4, 2);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutCreateWindow("Hello World!");
glutDisplayFunc(displayCall);
glutMainLoop();
return 0;
}
As a result I get:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 39
Current serial number in output stream: 40
Here is the stack trace:
fghCreateNewContext() at freeglut_window.c:737 0x7ffff7bbaa81
fgOpenWindow() at freeglut_window.c:878 0x7ffff7bbb2fb
fgCreateWindow() at freeglut_structure.c:106 0x7ffff7bb9d86
glutCreateWindow() at freeglut_window.c:1,183 0x7ffff7bbb4f2
main() at AlphaTest.cpp:51 0x4007df
Here is the last piece of code, after witch the program crashes:
createContextAttribs =
(CreateContextAttribsProc) fghGetProcAddress("glXCreateContextAttribsARB" );
if ( createContextAttribs == NULL ) {
fgError( "glXCreateContextAttribsARB not found" );
}
context = createContextAttribs( dpy, config, share_list, direct, attributes );
"glXCreateContextAttribsARB" address is obtained successfully, but the program crashes on its invocation.
If I specify OpenGL version less than 4.2 in "glutInitContextVersion()" program runs without errors.
Here is my glxinfo's OpelGL version:
OpenGL version string: 4.2.0 NVIDIA 285.05.09
I would be very appreciate any further ideas.
© Game Development or respective owner